Skip to content

chore: apply go fix modernizers - #1825

Merged
AmanGIT07 merged 1 commit into
mainfrom
chore/apply-go-fix
Aug 3, 2026
Merged

chore: apply go fix modernizers#1825
AmanGIT07 merged 1 commit into
mainfrom
chore/apply-go-fix

Conversation

@AmanGIT07

Copy link
Copy Markdown
Contributor

Summary

Applies Go 1.26's go fix across the repository at its fixed point — a second run produces no further changes — plus the small cleanups the fixer intentionally leaves behind.

Changes

  • interface{}any (~237 sites), pointer-helper calls → new(expr) (~231), manual loops → maps.Copy / slices.Contains (13), 3-clause loops → range-over-int (~10), goroutine boilerplate → sync.WaitGroup.Go (4) — 95 files, net −44 lines
  • Remove the five pointer helpers orphaned by the newexpr rewrite (every call site is now new(x))
  • go mod tidy (separate commit): golang.org/x/net moves to the indirect section — no first-party imports remain after refactor(server): serve unencrypted HTTP/2 natively #1818
  • Generated code is untouched (go fix skips it); no behavior changes

Test Plan

  • go build ./... and go vet ./... pass
  • make lint passes (0 issues)
  • make test passes (race detector, -count 2)
  • make e2e-test passes against live Postgres + SpiceDB containers
  • go fix -diff ./... is empty on the result (fixed point)

SQL Safety (if your PR touches *_repository.go or goqu.*)

  • Values flow through ? placeholders, goqu.Ex{}, or goqu.Record{} — never fmt.Sprintf or + building a query that gets executed.
  • ToSQL() callers capture and forward params (query, params, err := stmt.ToSQL(); db.…Context(ctx, …, query, params...)). Never query, _, err := ….
  • No ? placeholders inside single-quoted SQL literals in goqu.L (use make_interval(hours => ?)-style functions instead).
  • Any //nolint:forbidigo or // #nosec G20x annotation has a one-line justification on the same line that a reviewer can verify.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview Aug 3, 2026 7:12am

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 61daf116-8480-46ac-a6aa-c518c8f0e100

📥 Commits

Reviewing files that changed from the base of the PR and between db6d3dd and 046ab3f.

📒 Files selected for processing (95)
  • billing/checkout/service.go
  • billing/checkout/service_concurrent_test.go
  • billing/credit/service.go
  • billing/customer/service.go
  • billing/customer/service_concurrent_test.go
  • billing/customer/service_test.go
  • billing/invoice/service.go
  • billing/invoice/service_concurrent_test.go
  • billing/invoice/service_test.go
  • billing/product/service.go
  • billing/product/service_test.go
  • billing/subscription/service.go
  • billing/subscription/service_concurrent_test.go
  • billing/subscription/service_test.go
  • cmd/preferences.go
  • core/aggregates/orgbilling/service.go
  • core/aggregates/orgprojects/service.go
  • core/aggregates/orgtokens/service.go
  • core/aggregates/orgusers/service.go
  • core/audit/context.go
  • core/audit/logger.go
  • core/audit/service.go
  • core/audit/service_test.go
  • core/auditrecord/models/models.go
  • core/auditrecord/service.go
  • core/auditrecord/service_test.go
  • core/authenticate/service_test.go
  • core/authenticate/session/session.go
  • core/authenticate/strategy/oidc.go
  • core/event/service.go
  • core/invitation/service.go
  • core/membership/audit.go
  • core/preference/preference.go
  • core/preference/validator.go
  • core/user/service.go
  • core/webhook/service.go
  • internal/api/v1beta1connect/billing_invoice_test.go
  • internal/api/v1beta1connect/billing_usage_test.go
  • internal/api/v1beta1connect/policy_test.go
  • internal/api/v1beta1connect/resource_test.go
  • internal/reconcile/platformuser_reconciler_test.go
  • internal/reconcile/role_reconciler.go
  • internal/reconcile/role_reconciler_test.go
  • internal/reconcile/role_test.go
  • internal/store/postgres/audit_record.go
  • internal/store/postgres/audit_record_repository.go
  • internal/store/postgres/audit_record_repository_test.go
  • internal/store/postgres/billing_checkout_repository.go
  • internal/store/postgres/billing_customer_repository.go
  • internal/store/postgres/billing_customer_repository_test.go
  • internal/store/postgres/billing_invoice_repository.go
  • internal/store/postgres/billing_invoice_repository_test.go
  • internal/store/postgres/billing_product_repository.go
  • internal/store/postgres/billing_subscription_repository.go
  • internal/store/postgres/invitation.go
  • internal/store/postgres/invitation_repository.go
  • internal/store/postgres/kyc_repository.go
  • internal/store/postgres/org_billing_repository.go
  • internal/store/postgres/org_billing_repository_test.go
  • internal/store/postgres/org_invoices_repository.go
  • internal/store/postgres/org_invoices_repository_test.go
  • internal/store/postgres/org_pats_repository.go
  • internal/store/postgres/org_projects_repository.go
  • internal/store/postgres/org_projects_repository_test.go
  • internal/store/postgres/org_serviceuser_credentials_repository.go
  • internal/store/postgres/org_serviceuser_credentials_repository_test.go
  • internal/store/postgres/org_serviceuser_repository.go
  • internal/store/postgres/org_serviceuser_repository_test.go
  • internal/store/postgres/org_tokens_repository.go
  • internal/store/postgres/org_tokens_repository_test.go
  • internal/store/postgres/org_users_repository.go
  • internal/store/postgres/org_users_repository_test.go
  • internal/store/postgres/organization_repository.go
  • internal/store/postgres/policy_repository.go
  • internal/store/postgres/postgres_test.go
  • internal/store/postgres/project_users_repository.go
  • internal/store/postgres/project_users_repository_test.go
  • internal/store/postgres/user_orgs_repository.go
  • internal/store/postgres/user_orgs_repository_test.go
  • internal/store/postgres/user_projects_repository_test.go
  • internal/store/postgres/user_repository.go
  • internal/store/postgres/user_repository_test.go
  • internal/store/postgres/userpat_repository_test.go
  • internal/store/postgres/webhook_endpoint.go
  • internal/store/spicedb/relation_repository.go
  • pkg/file/file.go
  • pkg/metadata/metadata.go
  • pkg/utils/pointers.go
  • pkg/utils/rql.go
  • pkg/utils/slice.go
  • test/e2e/regression/authentication_test.go
  • test/e2e/regression/billing_test.go
  • test/e2e/regression/serviceusers_test.go
  • test/e2e/testbench/helper.go
  • test/e2e/testbench/stripe.go
🚧 Files skipped from review as they are similar to previous changes (94)
  • core/authenticate/session/session.go
  • internal/api/v1beta1connect/billing_invoice_test.go
  • internal/store/postgres/audit_record_repository.go
  • core/authenticate/service_test.go
  • core/aggregates/orgusers/service.go
  • internal/store/postgres/org_projects_repository.go
  • internal/store/postgres/user_projects_repository_test.go
  • core/audit/context.go
  • core/auditrecord/service_test.go
  • internal/store/postgres/org_serviceuser_credentials_repository_test.go
  • internal/store/postgres/org_invoices_repository_test.go
  • internal/store/postgres/billing_customer_repository_test.go
  • core/aggregates/orgprojects/service.go
  • billing/checkout/service_concurrent_test.go
  • core/preference/validator.go
  • internal/store/postgres/org_serviceuser_credentials_repository.go
  • core/authenticate/strategy/oidc.go
  • internal/store/postgres/audit_record.go
  • billing/credit/service.go
  • core/audit/logger.go
  • billing/customer/service.go
  • internal/store/postgres/audit_record_repository_test.go
  • core/audit/service.go
  • core/preference/preference.go
  • core/aggregates/orgtokens/service.go
  • internal/store/postgres/org_invoices_repository.go
  • pkg/utils/pointers.go
  • billing/customer/service_concurrent_test.go
  • core/invitation/service.go
  • internal/store/postgres/billing_product_repository.go
  • core/auditrecord/models/models.go
  • internal/api/v1beta1connect/resource_test.go
  • internal/store/postgres/invitation_repository.go
  • internal/store/postgres/org_serviceuser_repository.go
  • internal/store/postgres/user_repository_test.go
  • billing/customer/service_test.go
  • internal/store/postgres/kyc_repository.go
  • internal/store/postgres/org_projects_repository_test.go
  • core/aggregates/orgbilling/service.go
  • internal/store/postgres/org_users_repository.go
  • internal/store/postgres/project_users_repository_test.go
  • internal/store/postgres/org_billing_repository_test.go
  • billing/product/service.go
  • billing/subscription/service_test.go
  • internal/store/postgres/project_users_repository.go
  • core/user/service.go
  • billing/invoice/service_test.go
  • internal/store/postgres/organization_repository.go
  • pkg/metadata/metadata.go
  • internal/store/postgres/billing_subscription_repository.go
  • internal/store/postgres/org_billing_repository.go
  • billing/product/service_test.go
  • internal/store/postgres/user_orgs_repository.go
  • core/auditrecord/service.go
  • internal/store/postgres/org_users_repository_test.go
  • internal/store/postgres/billing_invoice_repository.go
  • internal/reconcile/platformuser_reconciler_test.go
  • internal/store/spicedb/relation_repository.go
  • internal/reconcile/role_reconciler.go
  • internal/api/v1beta1connect/billing_usage_test.go
  • internal/reconcile/role_reconciler_test.go
  • billing/subscription/service_concurrent_test.go
  • cmd/preferences.go
  • pkg/utils/slice.go
  • internal/reconcile/role_test.go
  • internal/store/postgres/billing_customer_repository.go
  • test/e2e/regression/authentication_test.go
  • internal/store/postgres/org_tokens_repository.go
  • test/e2e/testbench/helper.go
  • internal/store/postgres/user_repository.go
  • internal/store/postgres/webhook_endpoint.go
  • internal/store/postgres/org_serviceuser_repository_test.go
  • internal/store/postgres/org_tokens_repository_test.go
  • billing/invoice/service.go
  • internal/api/v1beta1connect/policy_test.go
  • test/e2e/regression/serviceusers_test.go
  • internal/store/postgres/userpat_repository_test.go
  • internal/store/postgres/user_orgs_repository_test.go
  • internal/store/postgres/invitation.go
  • internal/store/postgres/org_pats_repository.go
  • internal/store/postgres/billing_invoice_repository_test.go
  • core/audit/service_test.go
  • billing/checkout/service.go
  • test/e2e/regression/billing_test.go
  • core/event/service.go
  • billing/subscription/service.go
  • billing/invoice/service_concurrent_test.go
  • internal/store/postgres/policy_repository.go
  • pkg/utils/rql.go
  • internal/store/postgres/billing_checkout_repository.go
  • core/webhook/service.go
  • pkg/file/file.go
  • test/e2e/testbench/stripe.go
  • internal/store/postgres/postgres_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Refactor

    • Modernized internal type usage and collection handling for improved consistency and maintainability.
    • Simplified billing provider parameter construction without changing checkout, invoicing, subscription, or customer workflows.
    • Streamlined metadata copying, CSV header generation, query preparation, and validation logic.
    • Updated concurrency and iteration patterns across services and tests.
  • Bug Fixes

    • Audit record JSON now consistently includes the creation timestamp, even when empty.
  • Tests

    • Updated unit and end-to-end coverage to reflect the internal modernization while preserving existing behavioral assertions.

Walkthrough

The pull request applies Go modernization across billing, core, storage, utility, and test code. It replaces helper-based pointers, interface{} aliases, manual map and slice operations, older formatting, reflection, and loop forms without changing the main billing control flows.

Changes

Go modernization

Layer / File(s) Summary
Billing provider parameters and fixtures
billing/*, test/e2e/testbench/stripe.go
Stripe parameters and test expectations now use new(...). Billing concurrency tests use wg.Go and range loops.
Core and reconciliation helpers
core/*, internal/reconcile/*, pkg/utils/*
Metadata copying uses maps.Copy. Membership checks use slices.Contains. Generic values use any. Formatting and reflection use newer standard-library APIs.
Postgres query and metadata types
internal/store/postgres/*
Query parameter slices, scanner inputs, and metadata maps use any. SQL and scanning behavior remain unchanged.
End-to-end test updates
test/e2e/regression/*, test/e2e/testbench/*
Tests use modern map, formatting, pointer, and range-loop forms.
Audit record serialization
core/auditrecord/models/models.go
AuditRecord.CreatedAt now serializes with the created_at JSON property even when the value is zero.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: whoabhisheksah

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8def53cf-61b7-4192-81b0-e51fee272602

📥 Commits

Reviewing files that changed from the base of the PR and between 3b828eb and db6d3dd.

📒 Files selected for processing (96)
  • billing/checkout/service.go
  • billing/checkout/service_concurrent_test.go
  • billing/credit/service.go
  • billing/customer/service.go
  • billing/customer/service_concurrent_test.go
  • billing/customer/service_test.go
  • billing/invoice/service.go
  • billing/invoice/service_concurrent_test.go
  • billing/invoice/service_test.go
  • billing/product/service.go
  • billing/product/service_test.go
  • billing/subscription/service.go
  • billing/subscription/service_concurrent_test.go
  • billing/subscription/service_test.go
  • cmd/preferences.go
  • core/aggregates/orgbilling/service.go
  • core/aggregates/orgprojects/service.go
  • core/aggregates/orgtokens/service.go
  • core/aggregates/orgusers/service.go
  • core/audit/context.go
  • core/audit/logger.go
  • core/audit/service.go
  • core/audit/service_test.go
  • core/auditrecord/models/models.go
  • core/auditrecord/service.go
  • core/auditrecord/service_test.go
  • core/authenticate/service_test.go
  • core/authenticate/session/session.go
  • core/authenticate/strategy/oidc.go
  • core/event/service.go
  • core/invitation/service.go
  • core/membership/service.go
  • core/preference/preference.go
  • core/preference/validator.go
  • core/user/service.go
  • core/webhook/service.go
  • go.mod
  • internal/api/v1beta1connect/billing_invoice_test.go
  • internal/api/v1beta1connect/billing_usage_test.go
  • internal/api/v1beta1connect/policy_test.go
  • internal/api/v1beta1connect/resource_test.go
  • internal/reconcile/platformuser_reconciler_test.go
  • internal/reconcile/role_reconciler.go
  • internal/reconcile/role_reconciler_test.go
  • internal/reconcile/role_test.go
  • internal/store/postgres/audit_record.go
  • internal/store/postgres/audit_record_repository.go
  • internal/store/postgres/audit_record_repository_test.go
  • internal/store/postgres/billing_checkout_repository.go
  • internal/store/postgres/billing_customer_repository.go
  • internal/store/postgres/billing_customer_repository_test.go
  • internal/store/postgres/billing_invoice_repository.go
  • internal/store/postgres/billing_invoice_repository_test.go
  • internal/store/postgres/billing_product_repository.go
  • internal/store/postgres/billing_subscription_repository.go
  • internal/store/postgres/invitation.go
  • internal/store/postgres/invitation_repository.go
  • internal/store/postgres/kyc_repository.go
  • internal/store/postgres/org_billing_repository.go
  • internal/store/postgres/org_billing_repository_test.go
  • internal/store/postgres/org_invoices_repository.go
  • internal/store/postgres/org_invoices_repository_test.go
  • internal/store/postgres/org_pats_repository.go
  • internal/store/postgres/org_projects_repository.go
  • internal/store/postgres/org_projects_repository_test.go
  • internal/store/postgres/org_serviceuser_credentials_repository.go
  • internal/store/postgres/org_serviceuser_credentials_repository_test.go
  • internal/store/postgres/org_serviceuser_repository.go
  • internal/store/postgres/org_serviceuser_repository_test.go
  • internal/store/postgres/org_tokens_repository.go
  • internal/store/postgres/org_tokens_repository_test.go
  • internal/store/postgres/org_users_repository.go
  • internal/store/postgres/org_users_repository_test.go
  • internal/store/postgres/organization_repository.go
  • internal/store/postgres/policy_repository.go
  • internal/store/postgres/postgres_test.go
  • internal/store/postgres/project_users_repository.go
  • internal/store/postgres/project_users_repository_test.go
  • internal/store/postgres/user_orgs_repository.go
  • internal/store/postgres/user_orgs_repository_test.go
  • internal/store/postgres/user_projects_repository_test.go
  • internal/store/postgres/user_repository.go
  • internal/store/postgres/user_repository_test.go
  • internal/store/postgres/userpat_repository_test.go
  • internal/store/postgres/webhook_endpoint.go
  • internal/store/spicedb/relation_repository.go
  • pkg/file/file.go
  • pkg/metadata/metadata.go
  • pkg/utils/pointers.go
  • pkg/utils/rql.go
  • pkg/utils/slice.go
  • test/e2e/regression/authentication_test.go
  • test/e2e/regression/billing_test.go
  • test/e2e/regression/serviceusers_test.go
  • test/e2e/testbench/helper.go
  • test/e2e/testbench/stripe.go

Comment thread internal/store/postgres/audit_record.go
Go 1.26's go fix applied at its fixed point: interface{} to any,
pointer-helper calls to new(expr), manual loops to maps.Copy,
slices.Contains and range-over-int, and WaitGroup.Go where the shape
allows. The five pointer helpers orphaned by the rewrite are removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AmanGIT07
AmanGIT07 force-pushed the chore/apply-go-fix branch from db6d3dd to 046ab3f Compare August 3, 2026 07:11
@AmanGIT07
AmanGIT07 enabled auto-merge (squash) August 3, 2026 07:11
@AmanGIT07
AmanGIT07 merged commit 5b3280a into main Aug 3, 2026
10 of 11 checks passed
@AmanGIT07
AmanGIT07 deleted the chore/apply-go-fix branch August 3, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants